package com.jianyun.jyzs.presenter;

import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
import com.jianyun.jyzs.bean.MeUserInfo;
import com.jianyun.jyzs.model.MefrageModel;
import com.jianyun.jyzs.model.imdoel.IMeFragModel;
import com.jianyun.jyzs.view.iview.IMeFragmentView;

/**
 * Created by yangshijun on 2018/5/28.
 */

public class MeFragmentPresenter extends MvpBasePresenter<IMeFragmentView> {

    /**
     * 获取个人信息
     *
     * @param enterpriseCode
     * @param userId
     */
    public void getUserInfo(String enterpriseCode, String userId) {

        if (!isViewAttached()) {
            return;
        }
        MefrageModel.getInstance().getUserInfo(enterpriseCode, userId, new IMeFragModel.OnGetUserInfoListener() {
            @Override
            public void onSuccess(MeUserInfo userInfo) {
                getView().setUserinfo(userInfo);
            }

            @Override
            public void onFailed() {

            }

            @Override
            public void onException(String msg) {
                getView().onException(msg);
            }
        });
    }

}
